package net.studou.exception;

import java.lang.reflect.Field;

public class SecretException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7103055052441820110L;
	
	public static final int USER_LOCKED = 0;

	public static final int GET_FIELD_ERROR = 1;

	public static final int ENCRYPT_DECRYPT_ERROR = 2;

	public static final int SET_STATUS_ERROR = 3;

	public static final int SIGNATURE_ERROR = 4;

	private Object po;

	private Field field;

	private String key;

	private String operateValue;

	private String realValue;

	private int type = 0;

	public SecretException(String message, Throwable cause) {
		super(message, cause);
	}

	public SecretException(String message) {
		super(message);
		this.type = SecretException.USER_LOCKED;
	}

	public SecretException(String message, Throwable cause, Object po, Field field) {
		super(message, cause);
		this.po = po;
		this.field = field;
		this.type = SecretException.GET_FIELD_ERROR;
	}

	public SecretException(String message, Throwable cause, Object po, Field field, String operateValue) {
		super(message, cause);
		this.po = po;
		this.field = field;
		this.operateValue = operateValue;
		this.type = SecretException.SET_STATUS_ERROR;
	}

	public SecretException(String message, Throwable cause, Object po, Field field, String key, String operateValue) {
		super(message, cause);
		this.po = po;
		this.field = field;
		this.key = key;
		this.operateValue = operateValue;
		this.type = SecretException.ENCRYPT_DECRYPT_ERROR;
	}

	public SecretException(String message, Throwable cause, Object po, Field field, String key, String dataValue, String signature) {
		super(message, cause);
		this.po = po;
		this.field = field;
		this.key = key;
		this.realValue = dataValue;
		this.operateValue = signature;
		this.type = SecretException.SIGNATURE_ERROR;
	}

	public SecretException(Throwable cause) {
		super(cause);
	}

	public Object getPo() {
		return po;
	}

	public void setPo(Object po) {
		this.po = po;
	}

	public Field getField() {
		return field;
	}

	public void setField(Field field) {
		this.field = field;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getOperateValue() {
		return operateValue;
	}

	public void setOperateValue(String operateValue) {
		this.operateValue = operateValue;
	}

	public String getRealValue() {
		return realValue;
	}

	public void setRealValue(String realValue) {
		this.realValue = realValue;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

}
